package com.bt7274.mapper;

import com.bt7274.pojo.Post;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bt7274.pojo.bo.PostListBO;
import com.bt7274.pojo.vo.PostListVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 帖子表 ：记录每个板块下的帖子 Mapper 接口
 * </p>
 *
 * @author hp
 * @since 2025-03-25
 */
public interface PostMapper extends BaseMapper<Post> {

    Post selectPostById(String id);

    List<Post> selectPostList(PostListBO post);
    List<PostListVO> selectPostVOList(PostListBO post);

    int insertPost(Post post);

    int updatePost(Post post);

    int deletePostById(String id);

    int deletePostByIds(String[] ids);

    void updatePostLikeCounts(String postId, int likeCount);
    void updatePostDisLikeCounts(String postId, int dislikeCount);

    void updatePostViewCount(String postId, int viewCount);

    void incrementReplyCount(String id);

    void decrementReplyCount(String id);

    void updatePostUpdatedTime(String id);

    long countPostList(PostListBO bo);

    long countSomeOnePosts(@Param("userId") String userId,
                           @Param("onlyPublic") boolean onlyPublic);

    List<PostListVO> selectSomeOnePosts(@Param("userId") String userId,
                                        @Param("offset") int offset,
                                        @Param("pageSize") int pageSize,
                                        @Param("onlyPublic") boolean onlyPublic);
    List<PostListVO> selectPinnedPostList(String forumId);
}
